<?php

class Control_Model_Form_News extends Zend_Form {

    public function __construct($options = null) {
        parent::__construct($options);
        $this->setName('News');

        $id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');

        $title = new Zend_Form_Element_Text('title');
        $title->setLabel('Title:')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setAttrib('size', 50);

        $long_text = new Zend_Form_Element_Textarea('long_text');
        $long_text->setLabel('Text of news:')
                ->setRequired(true)
                ->addValidator('NotEmpty')
                ->setAttrib('class', 'elrte');

        $link = new Zend_Form_Element_Text('link');
        $link->setLabel('Link adress (http://link.ru):')
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->setAttrib('size', 50)
                ->setValue('#');

        $date = new ZendX_JQuery_Form_Element_DatePicker(
                        "date", array("label" => "Date Picker:"));
        $date->setJQueryParam('dateFormat', 'yy.mm.dd')
                ->setLabel('Date:')
                ->setValue(date("Y-m-d"));

        $main = new Zend_Form_Element_Checkbox('main');
        $main->setLabel('Show this news in main page')
                ->setCheckedValue('1')
                ->setUncheckedValue('0')
                ->setValue('1');


        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');

        $this->addElements(array($id, $title, $long_text, $link, $date, $main, $submit));
    }

}